package akka.in.action

import com.typesafe.config._
import akka.actor._

/**
  * Created by shichen on 2017/6/15.
  */

class Simple extends Actor {
  override def receive: Receive = {
    case m => println(s"recv $m!")
  }
}
object ch06_remoteActor extends App{
  val conf =
    """
      |akka {
      |  actor {
      |    provider = "akka.remote.RemoteActorRefProvider"
      |  }
      |
      |  remote {
      |    enabled-transports = ["akka.remote.netty.tcp"]
      |    netty.tcp {
      |      hostname = "0.0.0.0"
      |      port = 2551
      |    }
      |  }
      |}
    """.stripMargin
  //println(conf)
  val config = ConfigFactory.parseString(conf)
  val backend = ActorSystem("backend",config)
  backend.actorOf(Props[Simple],"simple")
  Thread.sleep(3000)
}
